//
//  ProductGategoryCell.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/15.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "ProductGategoryCell.h"
#import "CommonMacro.h"

@interface ProductGategoryCell ()

@end
@implementation ProductGategoryCell

- (void)awakeFromNib {
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self initSubviews];
    }
    return self;
}

- (void)initSubviews
{
    
    //1.商品分类
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(3, 0, SCREEN_WIDTH*0.4, 30)];
    self.titleLabel.text = @"商品分类:";
    self.titleLabel.textColor = UIColorWithRGBA(144, 144, 144, 1);
    self.titleLabel.font = [UIFont fontWithName:nil size:18];
    [self addSubview:self.titleLabel];
    
    CGFloat buttonX = self.titleLabel.frame.origin.x+10;
    CGFloat buttonY = self.titleLabel.frame.size.height+self.titleLabel.frame.origin.y+10;
    CGFloat buttonW = SCREEN_WIDTH*0.16;
    CGFloat buttonH = 20;
    CGFloat Marggin = 5;
    
    //2.草莓味
    self.buttonCao = [[UIButton alloc] initWithFrame:CGRectMake(5, buttonY,buttonW, buttonH)];
    [self.buttonCao setTitleColor:UIColorWithRGBA(146, 146, 146, 1) forState:UIControlStateNormal];
    self.buttonCao.layer.borderColor = UIColorWithRGBA(229, 229, 229, 1).CGColor;
    self.buttonCao.layer.borderWidth = 1;
    [self.buttonCao.titleLabel setFont:[UIFont fontWithName:nil size:15]];
    [self addSubview:self.buttonCao];
    self.buttonCao.tag = 1000;
    [self.buttonCao addTarget:self action:@selector(clickDifferentButton:) forControlEvents:UIControlEventTouchUpInside];
    
    //3.苹果味
    self.buttonApple = [[UIButton alloc] initWithFrame:CGRectMake(buttonX+buttonW, buttonY, buttonW, buttonH)];
    [self.buttonApple setTitleColor:UIColorWithRGBA(146, 146, 146, 1) forState:UIControlStateNormal];
    [self.buttonApple.titleLabel setFont:[UIFont fontWithName:nil size:15]];
    self.buttonApple.layer.borderColor = UIColorWithRGBA(229, 229, 229, 1).CGColor;
    self.buttonApple.layer.borderWidth = 1;
    [self addSubview:self.buttonApple];
    self.buttonCao.tag = 1001;
    [self.buttonCao addTarget:self action:@selector(clickDifferentButton:) forControlEvents:UIControlEventTouchUpInside];
    
    //4.香蕉味
    self.buttonBannar = [[UIButton alloc] initWithFrame:CGRectMake(self.buttonApple.frame.origin.x+buttonW+Marggin, buttonY, buttonW, buttonH)];
    [self.buttonBannar setTitleColor:UIColorWithRGBA(146, 146, 146, 1) forState:UIControlStateNormal];
    self.buttonBannar.layer.borderColor = UIColorWithRGBA(229, 229, 229, 1).CGColor;
    self.buttonBannar.layer.borderWidth = 1;
    [self.buttonBannar.titleLabel setFont:[UIFont fontWithName:nil size:15]];
    [self addSubview:self.buttonBannar];
    self.buttonCao.tag = 1002;
    [self.buttonCao addTarget:self action:@selector(clickDifferentButton:) forControlEvents:UIControlEventTouchUpInside];
    
    //5.番茄味
    self.buttonFan = [[UIButton alloc] initWithFrame:CGRectMake(self.buttonBannar.frame.origin.x+buttonW+Marggin, buttonY, buttonW, buttonH)];
    [self.buttonFan setTitleColor:UIColorWithRGBA(146, 146, 146, 1) forState:UIControlStateNormal];
    self.buttonFan.layer.borderColor = UIColorWithRGBA(229, 229, 229, 1).CGColor;
    self.buttonFan.layer.borderWidth = 1;
    [self.buttonFan.titleLabel setFont:[UIFont fontWithName:nil size:15]];
    [self addSubview:self.buttonFan];
    self.buttonCao.tag = 1003;
    [self.buttonCao addTarget:self action:@selector(clickDifferentButton:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)clickDifferentButton:(UIButton *)button
{
    if ([self.delegate respondsToSelector:@selector(changButtonStatus:)]) {
        [self.delegate changButtonStatus:button];
    }
}
@end
